package com.coolwen.service;

import com.coolwen.dao.RoleResourceMapper;
import com.coolwen.entity.RoleResource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by user on 2016/7/5.
 */
@Service("roleResourceService")
public class RoleResourceServiceImpl implements RoleResourceService {

    @Autowired
    private RoleResourceMapper roResDao;
    @Override
    public int add(RoleResource roleResource) {
        return roResDao.insertSelective(roleResource);
    }

    @Override
    public int delete(Integer id) {
        return roResDao.deleteByPrimaryKey(id);
    }

    @Override
    public int update(RoleResource roleResource) {
        return roResDao.updateByPrimaryKeySelective(roleResource);
    }

    @Override
    public RoleResource load(Integer id) {
        return roResDao.selectByPrimaryKey(id);
    }

    @Override
    public int deleteByRR(Integer roleid, Integer resid) {
        return roResDao.deleteByRR(roleid,resid);
    }
}
